var utils = require("./utils/utils");
var baoShuang = require("./apps/baoShuang/index");
var woAiZhuiJu = require("./apps/woAiZhuiJu/index");
var xiGua = require("./apps/xiGua/index");
var touTiao = require("./apps/touTiao/index");
var shanDianSouSuo = require("./apps/shanDianSouSuo/index");
var youShi = require("./apps/youShi/index");
var kuaiShouJiSu = require("./apps/kuaiShouJiSu/index");
var baiDuJiSu = require("./apps/baiDuJiSu/index");
var baiDuChangTing = require("./apps/baiDuChangTing/index");
var config = require("./config/index");
auto.waitFor();

var apps = [
  //prettier-ignore
  baoShuang,
  woAiZhuiJu,
  // xiGua,
  // touTiao,
  // shanDianSouSuo,
  // youShi,
  // kuaiShouJiSu,
  // baiDuJiSu,
  // baiDuChangTing,
];

function loop() {
  while (true) {
    for (var index = 0; index < apps.length; index++) {
      var app = apps[index];
      if (config.ignoreApps.indexOf(app.name) > -1) {
        continue;
      }
      if (!app.checkInstalled()) {
        continue;
      }
      if (!app.isOver) {
        app.main();
        var baseWait = 5;
        sleep(utils.getRandom(baseWait, baseWait + 3, 1000));
      }
    }
  }
}
loop();
